import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:ulearning_app/pages/sign_up/notifier/register_state.dart';
part 'register_notifier.g.dart';

//flutter pub run build_runner build --delete-conflicting-outputs
@riverpod
class RegisterNotifier extends _$RegisterNotifier {
  @override
  RegisterState build() {
    return RegisterState();
  }

  // 监听用户名输入框内容变化
  void onUserChange(String name) {
    state = state.copyWith(userName: name);
  }

  // 监听密码输入框内容变化
  void onPasswordChange(String password) {
    state = state.copyWith(password: password);
  }

  // 监听确认密码输入框内容变化
  void onConfirmPasswordChange(String confirmPassword) {
    state = state.copyWith(confirmPassword: confirmPassword);
  }

  // 监听邮箱输入框内容变化
  void onEmailChange(String email) {
    state = state.copyWith(email: email);
  }
}
